package hys.wssoc.modules.info.controller;

import hys.wssoc.common.utils.PageUtils;
import hys.wssoc.common.utils.R;
import hys.wssoc.modules.info.entity.IndustryDesEntity;
import hys.wssoc.modules.info.service.IndustryDesService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;



/**
 * 
 *
 * @author hys
 * @email 2439206957@qq.com
 * @date 2024-04-16 15:13:30
 */
@RestController
@RequestMapping("info/industrydes")
public class IndustryDesController {
    @Autowired
    private IndustryDesService industryDesService;

    @RequestMapping("/getAll")
    public R getAll(){
        return R.ok().put("data", industryDesService.list());
    }

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = industryDesService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{countrysideId}")
    public R info(@PathVariable("countrysideId") Integer countrysideId){
		IndustryDesEntity industryDes = industryDesService.getById(countrysideId);

        return R.ok().put("industryDes", industryDes);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("info:industrydes:save")
    public R save(@RequestBody IndustryDesEntity industryDes){
		industryDesService.save(industryDes);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("info:industrydes:update")
    public R update(@RequestBody IndustryDesEntity industryDes){
		industryDesService.updateById(industryDes);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("info:industrydes:delete")
    public R delete(@RequestBody Integer[] countrysideIds){
		industryDesService.removeByIds(Arrays.asList(countrysideIds));

        return R.ok();
    }

}
